//根据状态改变展示列表
$('.selectStatus').on('change',function(){
	var status = $(this).find('option:checked').attr('value');
	$.ajax({
		url:'/eshop/backEshop/eshopTouchListMore.html',
		type:'get',
		dataType:'html',
		data:{
			"status":status,
			"pageNo":1,
			"pageSize":10
		},
		success:function(data){
			$('.table').html(data);
		},
		error:function(){
		}
	})
})


//修改有意无意联系
$('.changeStatus').on('change',function(){
	var status = $(this).find('option:checked').attr('value');
	var eshopTouchId = $(this).attr('touchId');
	$.ajax({
		url:'/eshop/backEshop/modifyEshopTouchStatus.json',
		type:'get',
		dataType:'json',
		data:{
			"status":status,
			'eshopTouchId':eshopTouchId
		},
		success:function(data){
		}
	})
})

//搜索店铺
$('.searchEshopName').on('click',function(){
	var keyWord = $('.queryEshopName').val();
	$.ajax({
		url:'/eshop/backEshop/eshopTouchListMore.htm',
		type:'get',
		dataType:'html',
		data:{
			"keyWord":keyWord,
		},
		success:function(data){
			$('.table').html(data);
		}
	})
})

//增加店铺
$('.addShopName').on('click',function(){
	$('.modelBg').show();
	$('.agentListShopInfoBox').show();
	$('html,body').css('overflow','hidden');
})
//提交店铺名
$('.agentListShopInfoBoxBtnSubmit').on('click',function(){
	var eshopName = $('#shopInfoUserName').val();
	$.ajax({
		url:'/eshop/backEshop/addEshopTouchAction.json',
		type:'get',
		dataType:'json',
		data:{
			"eshopName":eshopName,
		},
		success:function(data){
			if(data['code']==200){
				$('.modelBg').hide();
				$('.agentListShopInfoBox').hide();
				$('html,body').css('overflow-y','scroll');
				alert("新增店铺成功！");
				window.location.href="/eshop/backEshop/eshopTouchList.htm";
			}
			
		}
	})
})
//取消浮层
$('.agentListShopInfoBoxBtnCancel').on('click',function(){
	$('.modelBg').hide();
	$('.agentListShopInfoBox').hide();
	$('html,body').css('overflow-y','scroll');
})
//修改备注信息
$('.changeBeizhu').on('click',function(){
	var remark = $(this).parent().parent().find('.textareaBeizhu').val();
	var eshopTouchId = $(this).parent().parent().attr('eshopTouchId');
	var contactPeople = $(this).parent().parent().find('.contactPeople').val();
	var contactPhone = $(this).parent().parent().find('.contactPhone').val();
	$.ajax({
		url:'/eshop/backEshop/modifyEshopTouchStatus.json',
		type:'get',
		dataType:'json',
		data:{
			"eshopTouchId":eshopTouchId,
			"contactPhone":contactPhone,
			"contactPeople":contactPeople,
			"remark":remark
		},
		success:function(data){
			if(data['code']==200){
				alert("修改备注信息成功！");
				window.location.href="/eshop/backEshop/eshopTouchList.htm";
			}
		
		}
	})
})

//分页
 var pageCount=$(".pageCount").val();
    $(".tcdPageCode").createPage({
        pageCount:pageCount,
        current:$('.pageNo').val(),
        backFn:function(p){
        	window.location.href="/eshop/backEshop/eshopTouchList.htm?pageNo="+p;
        }
    });